package com.nf.health.app.activity.global;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;

import com.nf.health.app.R;
import com.nf.health.app.adapter.WelcomeViewPagerAdapter;
import com.nf.health.app.fragment.WelcomeFourFragment;
import com.nf.health.app.fragment.WelcomeOneFragment;
import com.nf.health.app.fragment.WelcomeThreeFragment;
import com.nf.health.app.fragment.WelcomeTwoFragment;
import com.nf.health.app.utils.AppManager;

import java.util.ArrayList;
import java.util.List;

/** 
* @ClassName: WelcomeActivity 
* @Description:欢迎页
* @author Ian 
* @date 2015-11-4 上午11:05:09 
*  
*/
public class WelcomeActivity extends FragmentActivity {
	
	private ViewPager vp_welcome;
	private WelcomeViewPagerAdapter adapter ;
	private List<Fragment> fragments = new ArrayList<Fragment>();
	private WelcomeOneFragment oneFragment = new WelcomeOneFragment();
	private WelcomeTwoFragment twoFragment = new WelcomeTwoFragment();
	private WelcomeThreeFragment threeFragment = new WelcomeThreeFragment();
	private WelcomeFourFragment fourFragment = new WelcomeFourFragment();
//	private WelcomeFiveFragment fiveFragment = new WelcomeFiveFragment();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AppManager.getAppManager().addActivity(this);
		setContentView(R.layout.activity_welcome);
		vp_welcome = (ViewPager) findViewById(R.id.vp_welcomeId);
		init();
		
	}
	private void init() {
		fragments.add(oneFragment);		
		fragments.add(twoFragment);
		fragments.add(fourFragment);
		fragments.add(threeFragment);
//		fragments.add(fiveFragment);
		adapter = new WelcomeViewPagerAdapter(this.getSupportFragmentManager(), fragments);
		vp_welcome.setAdapter(adapter);
	}
	@Override
	protected void onDestroy() {
		AppManager.getAppManager().finishActivity(this);
		super.onDestroy();
	}
}
